//
//  XMAgreementViewController.m
//  XunMi
//
//  Created by MacBook on 2024/3/12.
//  Copyright © 2024 TieZhu. All rights reserved.
//

#import "XMAgreementViewController.h"
#import "XMAgreementTableViewCell.h"

@interface XMAgreementViewController ()

@end

@implementation XMAgreementViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupSubviews];
}

#pragma mark - setupSubViews
- (void)setupSubviews {
    [self.navLeft2Btn setTitle:@"用户协议" forState:UIControlStateNormal];
    self.view.backgroundColor = kHEX(@"#F2F2F2");
    self.navView.backgroundColor = kHEX(@"#F2F2F2");
    self.tableView.backgroundColor = UIColor.whiteColor;
    [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(20);
        make.right.equalTo(self.view).offset(-20);
        make.top.equalTo(self.navView.mas_bottom).offset(10);
        make.height.mas_equalTo(200);
    }];
    
    kCornerRadius(self.tableView, 10, 0, UIColor.clearColor);
    [self tableViewRegisterNibWithNibName:kStringFromClass(XMAgreementTableViewCell)];
    self.tableView.bounces = NO;
}

#pragma mark - UITableViewDataSource & UITableViewDelegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 4;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 50;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    XMAgreementTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kStringFromClass(XMAgreementTableViewCell)];
    
    switch (indexPath.row) {
        case 0:
            cell.titleLa.text = @"用户服务协议";
            cell.line.hidden = NO;
            break;
        case 1:
            cell.titleLa.text = @"隐私政策";
            cell.line.hidden = NO;
            break;
        case 2:
            cell.titleLa.text = @"充值协议";
            cell.line.hidden = NO;
            break;
        case 3:
            cell.titleLa.text = @"会员协议";
            cell.line.hidden = YES;
            break;
            
        default:
            break;
    }
    
    
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    switch (indexPath.row) {
        case 0:
        {
            
        }
            break;
            
        case 1:
        {
            
        }
            break;
            
        case 2:
        {
            
        }
            break;
            
        case 3:
        {
            
        }
            break;
            
        default:
            break;
    }
    
}


@end
